
package com.joysuch.wwyt.datadump.biz.query;

import cn.zlg.common.datadump.condition.QueryCondtionDef;
import cn.zlg.common.datadump.condition.QueryFieldCondition;
import cn.zlg.common.datadump.condition.QueryFieldConditionSet;
import cn.zlg.common.datadump.condition.SortFieldDef;
import com.joysuch.wwyt.bp.entity.dsl.QBpDepart;
import com.joysuch.wwyt.bp.entity.dsl.QBpIndustrialPipeline;
import com.joysuch.wwyt.mh.entity.dsl.QMhMajorHazard;
import com.querydsl.core.types.Order;

import java.util.Arrays;
import java.util.List;

public class BpIndustrialPiplelineDumpQueryBean implements QueryCondtionDef {

    @Override
    public List<QueryFieldConditionSet> getConditionSet() {
        return Arrays.asList(
                QueryFieldConditionSet.Builder().names("name", "nameOrCode").or(
                        new QueryFieldCondition("nameOrCode", QBpIndustrialPipeline.bpIndustrialPipeline,
                                QBpIndustrialPipeline.bpIndustrialPipeline.name, QBpIndustrialPipeline.bpIndustrialPipeline.id,
                                "contains"),
                        new QueryFieldCondition("nameOrCode", QBpIndustrialPipeline.bpIndustrialPipeline,
                                QBpIndustrialPipeline.bpIndustrialPipeline.code, QBpIndustrialPipeline.bpIndustrialPipeline.id,
                                "contains")
                ).build()
        );
    }

    @Override
    public QueryFieldCondition[] getAllConditionDef() {
        return new QueryFieldCondition[] { new QueryFieldCondition("ids", QBpIndustrialPipeline.bpIndustrialPipeline,
                QBpIndustrialPipeline.bpIndustrialPipeline.id, QBpIndustrialPipeline.bpIndustrialPipeline.id, "in"),

                new QueryFieldCondition("currentState", QBpIndustrialPipeline.bpIndustrialPipeline,
                        QBpIndustrialPipeline.bpIndustrialPipeline.currentState,
                        QBpIndustrialPipeline.bpIndustrialPipeline.id, "eq"), };
    }

    @Override
    public SortFieldDef[] getAllSortFieldDef() {
        return new SortFieldDef[] {
                new SortFieldDef(QBpIndustrialPipeline.bpIndustrialPipeline.id, "id", Order.DESC, true),
                new SortFieldDef(QBpIndustrialPipeline.bpIndustrialPipeline.name, "name", Order.ASC) };
    }
}
